package tas.co.in.daoimpl.codeInfo;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import tas.co.in.dao.codeInfo.CodeInfo;
import tas.co.in.domain.codeInfo.CodeInfoBean;

public class CodeInfoImpl extends SqlMapClientDaoSupport implements CodeInfo
{
	public boolean setCode(CodeInfoBean bean)
	{
		boolean flag = false;
		try 
		{
			if(bean.getCode().length() > 2 && bean.getGrpCode().equalsIgnoreCase("MNUITM"))
			{
				getSqlMapClient().insert("codeInfo.setCode2", bean);
			}
			else
			{
				getSqlMapClient().insert("codeInfo.setCode", bean);
			}
			flag = true;
		}
		catch (Exception e) 
		{
			System.out.println(e);
		}
		return flag;
	}
	
	public List<CodeInfoBean> getCode(CodeInfoBean bean)
	{
		try 
		{
			return getSqlMapClient().queryForList("codeInfo.getCode", bean);
		}
		catch (Exception e) 
		{
			System.out.println(e);
		}
		return null;
	}
}
